package cn.wanda.utils.db

import org.apache.spark.sql.DataFrame

class MySQLDBManager {

    def save2Mysql(dataFrame: DataFrame, url: String, tableName: String, username: String, password: String) {
        dataFrame.write.mode("append")
          .format("jdbc")
          .option("url", url)
          .option("dbtable", tableName)
          .option("user", username)
          .option("password", password)
          .option("driver", "com.mysql.jdbc.Driver")
          .save()
    }
}
